
<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    child1-vue
    {{userInfo}}
    <button @click="update">按钮</button>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState, mapActions } from "vuex";
export default {
  name: 'Home',
   computed: {
    ...mapState("global", {
      userInfo: (state) => {
        return JSON.stringify(state.userInfo);
      }
    })
  },
  methods: {
    ...mapActions("global", ["setGlobalState"]),
    update() {
      this.setGlobalState({ userInfo: "666" });
    },
  },
  mounted(){
    console.log(this.$store)
  }
}
</script>
